package cn.yx.com.qqui15.view;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.LinearLayout;

/**
 * Created by Smh on 2017/9/11.
 * <p>
 * --------- 日期 ------- 维护人 ------------ 变更内容 --------
 * on2017/9/11                        on${DATA}
 */
public class MyLinearLayout extends LinearLayout {
    //引入父控件
    private DragLayout mDragLayout;

    //初始化父控件
    public void setDragLayout(DragLayout mDragLayout) {
        this.mDragLayout = mDragLayout;
    }

    public MyLinearLayout(Context context) {
        super(context);
    }

    public MyLinearLayout(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    //调用监听事件
    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        //打开侧滑菜单时，返回true 拦截事件，禁止内容界面列表上下滑动
        if (mDragLayout != null && mDragLayout.isOpen()) {
            return true;
        }
        return super.onInterceptTouchEvent(ev);

    }
}
